package 网络编程.课后作业;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 2)、获取https://www.baidu.com的所有的IP地址
 * 使用InetAddress类的getAllByName(String host) 对某个有多个IP地址的主机可用于得到一个IP地址数组。
 */
public class M1 {
    public static void main(String[] args) {

        try {
            //查询本机地址
            InetAddress inetAddress = InetAddress.getByName("192.168.1.175");

            //查询网站ip地址

                InetAddress inetAddress1 = InetAddress.getByName("www.baidu.com");
                System.out.println(inetAddress1);

            InetAddress ia = InetAddress.getLocalHost();
            InetAddress iaa[] = InetAddress.getAllByName("www.baidu.com");
            System.out.println();


        } catch (UnknownHostException e) {
            e.printStackTrace();
        }

    }
}
